class Transformer:
    """
    将十进制的数字转换成其他进制
    num：要转换的数字
    p:要转换的进制
    """

    def transform(self, num, p):
        ans = []
        index = []
        ot = 'A'
        co = p
        for i in range(10):
            if p < 0: break
            index.append(i)
            p -= 1
        while p:
            index.append(ot)
            ot = chr(ord(ot) + 1)
            p -= 1

        while num > 0:
            ans.append(index[num % co])
            num //= co
        ans.reverse()
        return ans


transformer = Transformer()
tem = transformer.transform(11, 16)
print(''.join(i for i in tem))
